import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import com.jcraft.jsch.Channel;
import com.jcraft.jsch.ChannelExec;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Session;

public class T {
	public static void main(String[] args) throws JSchException, IOException {
		JSch jsch = new JSch();
		Session session = jsch.getSession("root", "192.168.10.189", 22);
		session.setPassword("123456");
		session.setConfig("StrictHostKeyChecking", "no");
		session.connect(30000);
		Channel channel = session.openChannel("exec");
		((ChannelExec) channel).setCommand("iostat -x -k 1 100");
		channel.setInputStream(null);
		((ChannelExec) channel).setErrStream(System.err);
		channel.connect();
		InputStream in = channel.getInputStream();
		BufferedReader reader = new BufferedReader(new InputStreamReader(in));
		String buf = null;
		while ((buf = reader.readLine()) != null) {
			System.out.println(buf);
		}
	}
}
